﻿using Common;
using Panuon.UI.Silver;
using Service.DtoModel;
using Service.Implements;
using System;
using System.Globalization;
using System.Windows;

namespace RunApp.PartialViews.Business
{
    /// <summary>
    /// 订单支付
    /// </summary>
    public partial class AddPayment : WindowX
    {
        #region Property        
        private string TableNo { get; set; }
        RoomService roomsService = new RoomService();
        BillConsumeService billConsumeService = new BillConsumeService();
        #endregion


        private void SurePay_Click(object sender, RoutedEventArgs e)
        {
            //billConsumeService.UpdateAsync();
        }
        /// <summary>
        /// 获取消费清单
        /// </summary>
        /// <param name="rtName"></param>
        private void GetDetail(string strOrder)
        {
            try
            {
                double _msMoney = 0;
                var parms = new ParmString { parm = strOrder };
                var _tabInfoRes = roomsService.GetTabCostdetails(parms).Result;
                if (_tabInfoRes.statusCode == (int)ApiEnum.Status)
                {
                    var TableDetailList = _tabInfoRes.data;
                    if (TableDetailList != null)
                    {
                        foreach (var item in TableDetailList)
                        {
                            _msMoney = _msMoney + item.msMoney;
                        }
                        tableInfoList.ItemsSource = TableDetailList;
                    }
                }
                else
                {
                    Logger.Default.ProcessError(_tabInfoRes.statusCode, "获取单个餐桌消费详情出现异常");
                }
                CultureInfo _currencyCate = new CultureInfo("zh-cn");
                txtAmountMoney.Text = _msMoney.ToString("c", _currencyCate);
            }
            catch (Exception ex)
            {
                Notice.Show("查询失败！", "提示", 3, MessageBoxIcon.Warning);
                Logger.Default.Error("获取单个餐桌消费详情出现异常", ex);
            }
        }
    }
}
